﻿@page "/Bas/Customer/BatchEdit"
@using nERP.ViewModel.Bas.CustomerVMs
@using System.ComponentModel.DataAnnotations
@inherits BasePage

<ValidateForm @ref="vform" Model="@Model" OnValidSubmit="@Submit">
    <div style="margin-bottom:10px;"> @WtmBlazor.Localizer["Sys.BatchEditConfirm"]</div>
    <Row ItemsPerRow="ItemsPerRow.Two" RowType="RowType.Normal">
        <BootstrapInput @bind-Value="@Model.LinkedVM.CustomerName" />
        <BootstrapInput @bind-Value="@Model.LinkedVM.ContactPerson" />
        <BootstrapInput @bind-Value="@Model.LinkedVM.PhoneNumber" />
        <BootstrapInput @bind-Value="@Model.LinkedVM.Email" />
        <BootstrapInput @bind-Value="@Model.LinkedVM.Faxing" />
        <BootstrapInput @bind-Value="@Model.LinkedVM.BeginCollect" />
        <BootstrapInput @bind-Value="@Model.LinkedVM.EndCollect" />
        <BootstrapInput @bind-Value="@Model.LinkedVM.TaxtRate" />
        <BootstrapInput @bind-Value="@Model.LinkedVM.Remark" />
        <BootstrapInput @bind-Value="@Model.LinkedVM.Address" />
        <BootstrapInput @bind-Value="@Model.LinkedVM.Bank" />
        <BootstrapInput @bind-Value="@Model.LinkedVM.TaxpayerNumber" />
        <BootstrapInput @bind-Value="@Model.LinkedVM.BankAccount" />
        <BootstrapInput @bind-Value="@Model.LinkedVM.LandlinePhone" />
    </Row>

    <div class="modal-footer table-modal-footer">
        <Button ButtonType="ButtonType.Submit" IsAsync="true" Text="@WtmBlazor.Localizer["Sys.Submit"]" Icon="fas fa-check" Color="Color.Success" />
        <Button OnClick="OnClose" Icon="fas fa-arrow-right-from-bracket" Text="@WtmBlazor.Localizer["Sys.Close"]" Color="Color.Info" />
    </div>

</ValidateForm>



@code {
    [Parameter]
    public string id { get; set; }
    [Parameter]
    public string[] ids { get; set; }
    private CustomerBatchVM Model = new CustomerBatchVM();
    private ValidateForm vform { get; set; }

    private async Task Submit(EditContext context)
    {
        Model.Ids = ids;
        await PostsForm(vform, "/api/Bas/Customer/BatchEdit", (s) => WtmBlazor.Localizer["Sys.BatchEditSuccess", s], method: HttpMethodEnum.POST);
    }


    public void OnClose()
    {
        CloseDialog();
    }

    protected override async Task OnInitializedAsync()
    {



        await base.OnInitializedAsync();
    }
}
